<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/page/share/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>用户注册 52橙子网</title>
<link rel="stylesheet" href="/shop/css/global/top.css" media="all" type="text/css"/>
<link rel="stylesheet" href="/shop/css/buyer/register.css" media="all" type="text/css"/>

<script language="javascript" src="/shop/js/xmlhttp.js" />
<script language="javascript" src="/shop/js/FoshanRen.js" ></script>
  <script language="javascript">
  
	function checkForm(){
		var form = document.forms[1];
		if(form.username.value=="" || form.username.value.length<6){
			alert("请输入长度6位以上的用户名");
			return false;
		}
		if(form.password.value=="" || form.password.value.length<6){
			alert("请输入长度6位以上的密码");
			return false;
		}
		if(form.password.value!=form.repassword.value){
			alert("两次输入的密码不正确");
			return false;
		}
		if(/[\W]/g.test(form.username.value)){
			alert("用户名中不能含有中文");
			return false;
		};
		if(form.validatecode.value==null || form.validatecode.value==""){
			alert("验证码不能为空!");
			return false;
		}
		return true;
	}
	function checkUsername(){
		var form = document.forms[0];
		var username = form.username.value;
		var viewobj = document.getElementById("checkResult");
		viewobj.innerHTML = "正在检测中...";
		send_request(function(value){viewobj.innerHTML=value},
		'<html:rewrite action="/user/reg"/>?method=isUserExsit&username='+ username, true);
	}
	
	 function refreshcode(){
		   document.getElementById("code").src="<html:rewrite action="/validate/manage"/>?method=build&a="+Math.random()+100;
		   return false;
	 }
			
  </script>
</head>

<body onload="">
<div class="container">
<jsp:include page="/WEB-INF/page/share/Head.jsp"/>
<html:form action="/user/reg" method="post" onsubmit="javascript:return checkForm()">
<input type="hidden" name="method" value="reg" />
<input type="hidden" name="directUrl" value="${param.directUrl}" />
<div class="box">
    <div class="box_header">
    	<div><img src="/shop/image/buyer/login_icon.png"/></div>
        <div><font>用户注册:</font></div>
    </div>
    
    <div class="box_body">
    	<div class="box_body_content">
        	<div class="textinput" style="height:60px">
            	 <font>会员名:</font>
                <input name="username" type="text" size="24px" tabindex="1"  maxlength="20" onkeyup="value=value.replace(/[\W]/g,'')" value="${requestScope.username }"/> &nbsp;&nbsp;
				<input type="button" name="check_username" value="检查会员名是否可用" onclick="checkUsername()" />
            </div>
            <div class="textright">
            	<font>5-20个字符(包括</font>
                <a>小写字母,数字,下划线</a>
                <font>),一旦注册成功</font>
                <font>会员名</font>
                <a>不得修改</a>
                <font>.</font><font color="red">${requestScope.username_null }</font>
                <div id="checkResult"></div>
            </div>
        </div>
        <div class="box_body_content">
           <div class="textinput">
           		<font>妮称:</font><input name="nickname" id="nickname" type="text" size="20px" maxlength="16" tabindex="2" value="${requestScope.nickname }"/>
           </div>
           <div class="textright">
           	昵称最多可输入20个英文字符，10个中文汉字<br/><font color="red">${requestScope.nickname_null }</font>
           </div>
        </div>
        <div class="box_body_content">
        	<div class="textinput">
            	 <font>密码:</font>
                <input name="password" value="" id="password" type="password" size="24px" maxlength="16" tabindex="3"/>
            </div>
            <div class="textright">
            	<font>密码由6-16位字符组成,请使用</font>
                <a>英文,数字,符号</a>
                <font>的组合</font>
                <font>密码.</font><br/>
                <font color="red">${requestScope.password_null }</font>
            </div>
        </div>
        <div class="box_body_content">
        	<div class="textinput">
            	 <font>再输入一遍密码:</font>
                <input name="repassword" value="" id="repassword" type="password" size="24px" maxlength="16" tabindex="4"/>
            </div>
            <div class="textright">
            	<font>再输入一遍您上面输入的密码.</font>
            </div>
        </div>
        <div class="box_body_content">
        	<div class="textinput">
            	 <font>电子邮件:</font>
                 <input name="email" id="email" type="text" size="28px" maxlength="45" tabindex="5" value="${requestScope.email }"/>
            </div>
            <div class="textright">
            	<a href="https://reg.cn.yahoo.com/cnreg/cnreg_first?id=78001" target="_blank">雅虎3.5G免费超大邮箱</a>、<a href="http://mail.sogou.com/register.jsp" target="_blank">搜狐邮箱</a>和<a href="http://reg.126.com/reg1.jsp" target="_blank">网易邮箱</a>。<br/>
            	<font color="red">${requestScope.email_null }</font>
            </div>
        </div>
        <div class="box_body_content">
        	<div class="textinput">
        	  <font>请输入验证码:</font>
        	  <input type="text" name="validatecode" size="28px" maxlength="45" tabindex="5" id="validatecode"/>
        	</div>
        	<div class="textright" id="validatecode_img">
        		<img id="code" src='<html:rewrite action="/validate/manage"/>?method=build' title="看不清点击刷新验证码" style="cursor : pointer;"  onclick="return refreshcode()"/>
        		<c:if test="${!empty validatecode_null}"><br/><font color="red">${requestScope.validatecode_null }</font></c:if>
        	</div>
        </div>
        <div class="box_body_content_btn">
        	<input type="submit" name="Submit" value="提交注册信息" tabindex="8" style="background-image: url('/shop/image/buyer/submit_register_btn.png'); border: 0;width=99px; height=27px;" />
        </div>
    </div>

</div>
</html:form>
<jsp:include page="/WEB-INF/page/share/Foot.jsp" />
</div>
</body>
</html>